package com.superpai;

import junit.framework.TestCase;

import com.superpai.api.DealAPI;
import com.superpai.api.ItemAPI;
import com.superpai.api.ShopAPI;
import com.superpai.api.UserAPI;
import com.superpai.common.Constants;
import com.superpai.response.deal.SellerSearchDealListResponse;
import com.superpai.response.item.GetItemResponse;
import com.superpai.response.shop.GetSellerMarketActiveResponse;
import com.superpai.response.shop.GetShopPromotionListResponse;
import com.superpai.response.user.GetReceiverAddressListResponse;
import com.superpai.response.user.UserLoginResponse;

/**
 * @author Devin.Hu
 * @date 2011-9-9
 * @version V1.0
 * @description 测试桩
 */
public class Test extends TestCase {

	/**
	 * @throws Exception
	 */
	public void testGetItem() throws Exception{
		ItemAPI api = new ItemAPI();
		GetItemResponse response = api.getItem("F04C3C280000000000703B1707A69CF2");
		if(response.isSuccess()){
			System.out.println(response.getItemName());
		}
	}
	
	/**
	 * 卖家查找订单列表信息
	 * @throws Exception
	 */
	public void testSellerSearchDealList() throws Exception{
		DealAPI api = new DealAPI();
		SellerSearchDealListResponse response = api.sellerSearchDealList(Constants.sellerUin, null, null, null, 1);
		if(response.isSuccess()){
			System.out.println(response.getPageTotal());
		}
	}
	
	/**
	 * 查询买家收货地址列表
	 * @throws Exception
	 */
	public void testGetReceiverAddressList() throws Exception{
		UserAPI api = new UserAPI();
		UserLoginResponse response1 = api.userLogin("295893265","huxinwu123");
		GetReceiverAddressListResponse response = api.getReceiverAddressList(295893265,response1.getInfo().getToken());
		if(response.isSuccess()){
			System.out.println(response.getReceiverAddressList().get(0).getAddress());
		}
	}
	
	/**
	 * 查询买家收货地址列表
	 * @throws Exception
	 */
	public void testUserLogin() throws Exception{
		UserAPI api = new UserAPI();
		UserLoginResponse response = api.userLogin("295893265","huxinwu");
	}
	
	
	/**
	 * 查询店铺满减满送活动信息
	 * @throws Exception
	 */
	public void testGetSellerMarketActive() throws Exception{
		ShopAPI api = new ShopAPI();
		GetSellerMarketActiveResponse response = api.getSellerMarketActive(Constants.sellerUin);
		if(response.isSuccess()){
			System.out.println(response.getContentList().size());
		}
	}
	
	/**
	 * 查询店铺促销活动信息
	 * @throws Exception
	 */
	public void testGetShopPromotionList() throws Exception{
		ShopAPI api = new ShopAPI();
		GetShopPromotionListResponse response = api.getShopPromotionList(Constants.sellerUin);
		if(response.isSuccess()){
			System.out.println(response.getShopPromotionList().size());
		}
	}
}
